#ifndef LAND_H
#define LAND_H

#include "D3DConfiguration.h"

struct ID3D10Device;
struct ID3D10Buffer;

namespace D3D10Utils
{
	struct Vertex;

	class Land
	{
	public:
		Land(const unsigned __int32 rows, const unsigned __int32 columns);
		~Land();

		void init(ID3D10Device * const device, const float cellSpacingX, const float cellSpacingZ);
		void draw();

	private:
		Vertex* createVertices(const float cellSpacingX, const float cellSpacingZ);
		unsigned __int32* createIndices();
		void computeNormals(Vertex * const vertices, const unsigned __int32 * const indices);
		void initVertexBuffer(const Vertex * const vertices);
		void initIndexBuffer(const unsigned __int32 * const indices);

		ID3D10Device *mDevice;
		ID3D10Buffer *mVertexBuffer;
		ID3D10Buffer *mIndexBuffer;

		const unsigned __int32 mNumVertices;
		const unsigned __int32 mNumFaces;

		const unsigned __int32 mRows;
		const unsigned __int32 mColumns;
	};
}

#endif // LAND_H
